/*
 * Copyright (c) 2005 -2008 Reliable Source, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Mozilla Public License v.1.1,
 * BSD, and Eclipse Public License v1.0 which accompanies this
 * distribution and is available at:
 *
 * 		http://www.eclipse.org/legal/epl-v10.html
 * 		http://www.opensource.org/licenses/bsd-license.php
 * 		http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * Contributors:
 *     IBM Corporation	     -  http://ibm.com
 *     	- initial API and implementation
 *
 *     patientos.org         - http://patientos.org
 *     	- domain and database persistence layer
 *
 *     Reliable Source, Inc. - http://reliablesource.org
 *     	- Symbiosys Application Framework,
 *     	- Symbiosys Application, Symbiosys Product
 *
 */
package org.reliablesource.symbiosys.ui.tests.viewers;

import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

import org.eclipse.ui.tests.harness.util.CallHistory;

import org.reliablesource.client.ui.viewers.ReliableViewer;


/**
 *
 * ReliableTraceViewer.java<br>
 * Created on: Jun 27, 2008<br>
 *
 * @author <a href="mailto:dennis.park@gmail.com">Dennis Park</a>
 *
 * @category
 * @since 1.0
 */
public class ReliableTraceViewer extends ReliableViewer {
    protected CallHistory callTrace;

    public ReliableTraceViewer() {
        super();
        callTrace = new CallHistory(this);
    }

    @Override
    public void addOpenListener(IOpenListener _dblClickListener) {
        super.addOpenListener(_dblClickListener);
        callTrace.add(Messages.ReliableTraceViewer_0);
    }

    @Override
    public void createViewerControl(Composite _contentParent) {
        callTrace.add(Messages.ReliableTraceViewer_1);
        contentComposite = new Composite(_contentParent, SWT.NONE);
    }

    @Override
    public void dispose() {
        callTrace.add(Messages.ReliableTraceViewer_2);

        callTrace.printToConsole();
        System.err.println(Messages.ReliableTraceViewer_3);
        System.err.println(Messages.ReliableTraceViewer_4);
        System.err.println(Messages.ReliableTraceViewer_3);
        super.dispose();
    }

    @Override
    public void init() {
        super.init();
        callTrace.add(Messages.ReliableTraceViewer_6);
    }

    @Override
    public void setInput(Object _input) {
        super.setInput(_input);
        callTrace.add(Messages.ReliableTraceViewer_7);
    }

    public CallHistory getCallTrace() {
        return callTrace;
    }

    public void close() {
        callTrace.add(Messages.ReliableTraceViewer_8);
    }

    @Override
    public void setSelection(ISelection selection, boolean reveal) {
        callTrace.add(Messages.ReliableTraceViewer_9);
    }

    /* (non-Javadoc)
     * @see org.reliablesource.client.ui.viewers.IReliableViewer#setFocus()
     */
    public boolean setFocus() {
        callTrace.add(Messages.ReliableTraceViewer_10);

        return false;
    }
}
